package org.algorithm.Sort;

public class MergeSort0 {
    public static void main(String[] args) {

    }

    public void split(int [] nums,int start,int end,int [] temp){
        if (start>=end){
            return;
        }

        int mid =(start+end)>>>1;
        split(nums,start,mid,temp);
        split(nums,mid+1,end,temp);
        merge(nums,start,mid,mid+1,end,temp);
    }

    public void merge(int []nums,int leftStart,int leftEnd,int rightStart,int rightEnd,int [] temp){
        int curr = leftStart;
        while (leftStart<=leftEnd && rightStart<=rightEnd){
            if (nums[leftStart]<nums[rightStart]){
                temp[curr]=nums[leftStart];
                curr++;
                leftStart++;
            }else {
                temp[curr]=nums[rightStart];
                curr++;
                rightStart++;
            }
        }

        if (leftStart==leftEnd){
            //拷贝操作
        }

        if (rightStart==rightEnd){
            //拷贝操作
        }
    }

}
